<!--
@license
Copyright 2020 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="toolbar">
  <metrics-tag-filter></metrics-tag-filter>
  <mat-button-toggle-group class="filter-view" multiple appearance="standard">
    <button
      mat-button
      class="filter-view-button"
      role="checkbox"
      [attr.aria-checked]="filteredPluginTypes.size === 0"
      (click)="onPluginTypeAllToggled.emit()"
    >
      All
    </button>
    <button
      mat-button
      class="filter-view-button"
      role="checkbox"
      [attr.aria-checked]="filteredPluginTypes.has(PluginType.SCALARS)"
      (click)="onPluginTypeToggled.emit(PluginType.SCALARS)"
    >
      Scalars
    </button>
    <button
      mat-button
      class="filter-view-button"
      role="checkbox"
      [attr.aria-checked]="filteredPluginTypes.has(PluginType.IMAGES)"
      (click)="onPluginTypeToggled.emit(PluginType.IMAGES)"
    >
      Image
    </button>
    <button
      mat-button
      class="filter-view-button"
      role="checkbox"
      [attr.aria-checked]="filteredPluginTypes.has(PluginType.HISTOGRAMS)"
      (click)="onPluginTypeToggled.emit(PluginType.HISTOGRAMS)"
    >
      Histogram
    </button>
  </mat-button-toggle-group>
  <div class="right-items">
    <button
      mat-stroked-button
      [ngClass]="{
        'checked': isSidepaneOpen,
        'settings-button': true
      }"
      i18n-aria-label="Label on a toolbar button to toggle the settings side pane."
      aria-label="Toggle settings side pane"
      [attr.aria-pressed]="isSidepaneOpen"
      (click)="onSettingsButtonClicked.emit()"
    >
      <mat-icon svgIcon="settings_24px"></mat-icon>
      Settings
    </button>
  </div>
</div>
<div class="split-content">
  <div cdkScrollable [class.main]="true" [class.filter-view]="showFilteredView">
    <metrics-filtered-view
      *ngIf="showFilteredView"
      [cardObserver]="cardObserver"
    ></metrics-filtered-view>
    <!-- Always render the metrics-pinned-view as a performance optimization--it makes view transition
    from filtered view to card view quicker. -->
    <metrics-pinned-view
      [style.display]="showFilteredView ? 'none' : ''"
      [cardObserver]="cardObserver"
    ></metrics-pinned-view>
    <div *ngIf="initialTagsLoading" class="loading-container">
      <mat-spinner diameter="36"></mat-spinner>
    </div>
    <!-- Always render the metrics-card-groups as a performance optimization--it makes view transition
    from filtered view to card view quicker. -->
    <metrics-card-groups
      [style.display]="showFilteredView ? 'none' : ''"
      [cardObserver]="cardObserver"
    ></metrics-card-groups>
  </div>
  <div class="sidebar" *ngIf="isSidepaneOpen">
    <div class="header">
      <h2 class="title">Settings</h2>
      <button
        mat-icon-button
        (click)="onCloseSidepaneButtonClicked.emit()"
        i18n-aria-label="Label on a button to close the settings side pane."
        aria-label="Close side pane"
      >
        <mat-icon svgIcon="close_24px"></mat-icon>
      </button>
    </div>
    <metrics-dashboard-right-pane></metrics-dashboard-right-pane>
  </div>
</div>
